package io.sage.modules.runner;

import io.sage.common.rxtx.RxtxConfig;
import io.sage.rfid.config.RfidConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class ApplicationUHFImpl implements ApplicationRunner {

    @Value("${uhf.ip}")
    private String serverIp;
    @Value("${uhf.port}")
    private Integer serverPort;
    @Autowired
    public RxtxConfig rxtxConfig;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        boolean isAction = rxtxConfig.ipServerAction(true,serverIp,serverPort);
        if(isAction){
            System.out.println(serverIp+"："+serverPort+" uhf读卡器启动成功");
        }else{
            System.err.println(serverIp+"："+serverPort+"uhf读卡器启动失败");
        }
    }
}